<?php
	require "conexion.php";
	$sql 		= "SELECT 
						descripcion,
						imagen_chica, 
						imagen_grande
					FROM 
						galeria_imagenes";
	$imgs 		= mysqli_query($link,$sql);

	$sql 		= "SELECT 
						descripcion,
						link
					FROM 
						galeria_videos";
	$videos		= mysqli_query($link,$sql);
	$cant_vid	= mysqli_affected_rows($link);
	
	mysqli_close($link);

	$titulo = "Multimedia";
	require "cabecera.php";
?>
	<meta name="keywords" content="">
	
	<link rel="stylesheet" href="lightbox/css/screen.css">
	<link rel="stylesheet" href="lightbox/css/lightbox.css">
</head>
<body>

	<?php
		include "menu_datos.php";
		include "menu_arriba.php";
	?>
	
	<div id="fotos" name="fotos" class="seccion">
		<h2 class="titulo_naranja">Fotos</h2>
		
		<div class="image-row">
			<div class="image-set">
			<?php
				$path = "images/galeria/";
				while ($img = mysqli_fetch_assoc($imgs)) {
				?>
					<a class="example-image-link" href="<?php echo $path . $img["imagen_grande"] ?>" data-lightbox="example-set" data-title="<?php echo $img["descripcion"] ?>">
						<img class="example-image" src="<?php echo $path . $img["imagen_chica"] ?>" alt=""/></a>
	            <?php }	?>
			</div>
		</div>
	</div>
	<?php if ($cant_vid > 0) { ?>
		<div id="videos" name="videos" class="seccion">
			<h2 class="titulo_naranja">Videos</h2>
			<?php
				while ($vid = mysqli_fetch_assoc($videos)) {
			?>
				<iframe width="400" height="300"
					src="<?php echo $vid["link"] ?>">
				</iframe>
			<?php }	?>
		</div>
	<?php }	?>
	<?php
		include "pie.php";
	?>
	<script src="lightbox/js/lightbox.min.js"></script>
</body>
</html>